<admintpl file="header" />
<style type="text/css">
	.error_info{
		color: red;
		font-size: 14px;
	}
	.sucess_info{
		color: green;
		font-size: 14px;
	}
</style>
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Finance/charge_log')}">消费记录</a></li>
			<li class="active"><a href="{:U('Finance/charge')}">账户消费</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" action="{:U('Finance/charge')}">
			<fieldset>
			
				<div class="control-group">
					<label class="control-label">手机号</label>
					<div class="controls">
						<input type="text" id="mobile" name="mobile" placeholder="输入充值客户手机号"  required="required" style="cursor: pointer;">&nbsp;<a id="check-user" style="cursor: pointer;">检验</a><br/><span id="info"></span>
					</div>

				</div>
				<div class="control-group">
					<label class="control-label">消费金额</label>
					<div class="controls">  
						<input type="number" name="money" placeholder="输入消费金额" min="1" required="required">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">备注</label>
					<div class="controls">  
						<textarea name="remarks"></textarea>
					</div>
				</div>
				</div>
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">消费</button>
				<a class="btn" href="javascript:history.back(-1);">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
</body>
<script type="text/javascript">
    $('#check-user').click(function(){
    	var mobile = $("#mobile").val();
    	var url    = "{:U('Customer/isCustomer')}";
    	$.post(url,{mobile:mobile},function(data){
            if(data.status == 1){
            	$("#info").html('客户姓名：'+data.name+'&nbsp;&nbsp;余额：'+data.money);
            	$("#info").addClass('sucess_info');
            }else{
            	$("#info").text('不存在该客户！');
            	$("#info").addClass('error_info');
            }
    	})
    })
</script>
</html>